<html>
  <head>
    <title>Gaelic vowel flashcards</title>

    <script type="text/javascript">

<!--

  function nextVocab() {
    // chooses new word and displays it in relevant cell
    var c = document.getElementById("vocabCell"); // identify td element
    var oldVocab = c.firstChild.data;
    var newVocab = randomVocab();
    // try to make sure new word is different from previous one
    if (newVocab == oldVocab) newVocab = randomVocab();
    if (newVocab == undefined) {
      alert("No vocabulary found!");
      return;
    }
    c.firstChild.data = newVocab; // display new word
    document.forms[0].elements[0].value = newVocab; // update hidden field
  }
  
  function randomVocab() {
    // return a random word
    var vocab = [
                 "ri", 
                 "ris", 
                 "min",
                 "sin", 
                 "tric", 
                 "mic", 
                 "thig", 
                 "litir",
                 "milis",
                 "imich",
                 "sgillinn",
                 "fios",
                 "lios",
                 "bior",
                 "briogais",
                 "\u00ECm",
                 "m\u00ECn",
                 "s\u00ECn",
                 "ch\u00EC",
                 "sg\u00ECth",
                 "d\u00ECreach",
                 "binn",
                 "cinn",
                 "till",
                 "cill",
                 "f\u00ECor",
                 "s\u00ECos",
                 "s\u00ECoda",
                 "cr\u00ECoch",
                 "de",
                 "le",
                 "teth",
                 "leth",
                 "eadar",
                 "cead",
                 "fead",
                 "beag",
                 "leag",
                 "creag",
                 "leis",
                 "ceist",
                 "bheil",
                 "d\u00E9",
                 "an-d\u00E9",
                 "feum",
                 "leum",
                 "ceum",
                 "Seumas",
                 "feumaidh",
                 "fh\u00E9in",
                 "f\u00E9idh",
                 "r\u00E9idh",
                 "l\u00E9ir",
                 "c\u00E9ile",
                 "fear",
                 "bean",
                 "lean",
                 "sean",
                 "leabaidh",
                 "s\u00E8imh",
                 "gn\u00E8",
                 "'s\u00E8",
                 "G\u00E0idheal",
                 "p\u00E0ipear",
                 "ad", 
                 "cas", 
                 "can",
                 "mac", 
                 "abair", 
                 "aran", 
                 "athair", 
                 "bata",
                 "fada",
                 "balach",
                 "falamh",
                 "tapaidh",
                 "math",
                 "baile",
                 "caileag",
                 "cailleach",
                 "maide",
                 "each",
                 "seachd",
                 "speal",
                 "dealbh",
                 "sealg"
                ];
    var n = Math.floor(Math.random()*vocab.length);
    return vocab[n];
  }

  function flip() {
    // change Gaelic into English
    var c = document.getElementById("vocabCell"); // identify td element
    var k = c.firstChild.data; // get the English word
    var r = toEnglish(k); // convert Gaelic to English
    c.style.fontSize = "40pt";
    c.firstChild.data = r; // display English
  }
  
  function flop() {
    var c = document.getElementById("vocabCell"); // identify td element
    // retrieve hidden field:
    c.style.fontSize = "80pt";
    c.firstChild.data = document.forms[0].elements[0].value; // display Gaelic again
  }
  
  function toEnglish(k) {
    // look up Gaelic word in dictionary
    switch(k) {
      case "ri": return "to [ri]";
      case "ris": return "to him [ri\u0283]";
      case "min": return "flower [min]";
      case "sin": return "that [\u0283in]";
      case "tric": return "often [trixk]";
      case "mic": return "sons [mixk]";
      case "thig": return "to come [hig]";
      case "litir": return "letter [lixtj\u026Ar]";
      case "milis": return "sweet [mil\u026A\u0283]";
      case "imich": return "to go [im\u026Ax]";      
      case "sgillinn": return "penny [sgil\u026An]";
      case "fios": return "knowledge [fis]";
      case "lios": return "garden [lis]";
      case "bior": return "point [bir]";
      case "briogais": return "trousers [brig\u026A\u0283]";    
      case "\u00ECm": return "butter [i:m]";  
      case "m\u00ECn": return "soft [mi:n]";  
      case "s\u00ECn": return "to stretch [\u0283i:n]";  
      case "ch\u00EC": return "will see [xi:]";  
      case "sg\u00ECth": return "tired [sgi:]";  
      case "d\u00ECreach": return "straight [\u017Ei:r\u0259x]";  
      case "binn": return "sweet [bi:n]";  
      case "cinn": return "heads [ki:n]";  
      case "till": return "to return [\u010Di:l]";  
      case "cill": return "churchyard [ki:l]";  
      case "f\u00ECor": return "true [fi:r]"; 
      case "s\u00ECos": return "down [\u0283i:s]";  
      case "s\u00ECoda": return "silk [\u0283i:d\u0259]";  
      case "cr\u00ECoch": return "border [kri:x]";  
      case "de": return "of [\u017E\u025B]";  
      case "le": return "with [l\u025B]";  
      case "teth": return "hot [\u010De]";  
      case "leth": return "half [le]";  
      case "eadar": return "between [ed\u0259r]";  
      case "cead": return "right [ked]"; 
      case "fead": return "whistle [fed]";  
      case "beag": return "small [beg]";  
      case "leag": return "to chop down [leg]";  
      case "creag": return "cliff [kreg]";  
      case "leis": return "with him [le\u0283]";  
      case "ceist": return "question [ke\u0283t]";
      case "bheil": return "verb form [vel]";  
      case "d\u00E9": return "what [\u017Ee:]";
      case "an-d\u00E9": return "yesterday [an \u017Ee:]";
      case "feum": return "use [fe:m]";
      case "leum": return "to jump [le:m]";
      case "ceum": return "step [ke:m]";
      case "Seumas": return "James [\u0283e:m\u0259s]";
      case "feumaidh": return "must [fe:m\u026A]";
      case "fh\u00E9in": return "self [he:n]";
      case "f\u00E9idh": return "deer (pl) [fe:]";
      case "r\u00E9idh": return "level [re:]";
      case "l\u00E9ir": return "visible [le:r]";
      case "c\u00E9ile": return "partner [ke:l\u0259]";
      case "fear": return "man [f\u025Br]";
      case "bean": return "wife [b\u025Bn]";
      case "lean": return "to follow [l\u025Bn]";
      case "sean": return "old [\u0283\u025Bn]";
      case "leabaidh": return "bed [l\u025Bb\u026A]"; 
      case "s\u00E8imh": return "quiet [\u0283\u025B:v]";
      case "gn\u00E8": return "gender [gr\u025B:]";
      case "'s\u00E8": return "it is [\u0283\u025B:]";
      case "G\u00E0idheal": return "Gael [g\u025B:\u0259l]";
      case "p\u00E0ipear": return "paper [p\u025B:p\u025Br]";
      case "ad": return "hat [ad]";
      case "cas": return "foot [kas]";
      case "can": return "to say [kan]";
      case "mac": return "son [maxk]";
      case "abair": return "to say [ab\u026Ar]";
      case "aran": return "bread [aran]";
      case "athair": return "father [ah\u026Ar]";
      case "bata": return "bat [baxt\u0259]";
      case "fada": return "long [fad\u0259]";
      case "balach": return "boy [bal\u0259x]";
      case "falamh": return "empty [fal\u0259v]";
      case "tapaidh": return "quick ['taxp\u026A]";
      case "math": return "good [ma]";
      case "baile": return "town [bal\u0259]";
      case "caileag": return "girl [kaljag]";
      case "cailleach": return "old woman [kaljax]";
      case "maide": return "stick [ma\u017E\u0259]";
      case "each": return "horse [jax]";
      case "seachd": return "seven [\u0283axg]";
      case "speal": return "scythe [spjal]"
      case "dealbh": return "picture [\u017Ealav]";
      case "sealg": return "to hunt [\u0283alag]";
    }
  }
  
-->
    </script>

  </head>

  <body style="background-color: #CCCC99">

    <p>
      <table style="width: 400px; height: 250px;padding: 5px" border="3"
             align="center">
        <tr style="text-align: center">
          <td id="vocabCell"
              style="font-size: 80pt; background-color: white; font-family: serif"
              onmouseover="flip();" onmouseout="flop();">
            &nbsp;
          </td>
        </tr>
      </table>
    </p>
    <p>
      <table style="padding: 10px" align="center">
        <tr style="text-align: center">
          <td>
	    <button style="font-size: 16pt" onclick="nextVocab();">
              Next
	    </button>
	  </td>
        </tr>
      </table>
    </p>

    <form>
      <input type="hidden" value="&nbsp;"/> <!-- remembers current word -->
    </form>

    <script type="text/javascript">
      nextVocab();
    </script>

  </body>
</html>


